<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>测试跨域</title>
<script type="text/javascript" src="js/lib/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $("#button_getUser").click(function(){
            //异步请求json数据
            $.ajax({
                type:"POST",
                url:"http://localhost:8087/JavaEE/testCrossDomainController.do?getUserList",
                success:function(data){
                    //迭代返回的json数据
                    $.each(data,function(i,user){
                        $("#results").append(user.userName+"---"+user.password+"<br>");
                    });
                },
                error:function(e) {
                    alert("出错："+e);
                }
            });
        });
    });
</script>
</head>
<body>
    <input type="button" id="button_getUser" value="获取用户列表"><br>
    用户信息：<br>
    <div id="results">
    
    </div>
</body>
</html>